package org.aplombh.java.interview.ms;


// 1000!
public class Factorial {
    public static void main(String[] args) {
        // 1000 * 999 * 998 * ... *  2 * 1 = xxxxxxxxxxxxxxxxx = a * 10^n
        // log_10 ( 1000!) = log_10(a * 10^n) = n + log_10(a)

        int ans = 0;
        double m = 1;
        for (int i = 1; i <= 1000; i++) {
            ans += Math.log10(i);
            m *= i;
        }
        System.out.println(ans);
        System.out.println(m);
    }
}
